package com.example.lanouhn.bantangapp.activities.utils;


import com.example.lanouhn.bantangapp.activities.contants.Search_deildelist;
import com.example.lanouhn.bantangapp.activities.contants.Search_hottag;
import com.example.lanouhn.bantangapp.activities.contants.Search_hottag_url;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * 解析Json数据
 */
public class JsonUtils_Search_hottag {

    /**
     * @param json json字符串
     * @return 搜索框下的热门数据
     */
    public static List<Search_hottag> gethottagURL(String json) {
        List<Search_hottag> list = new ArrayList<>();
        try {
            JSONObject jsonObject = new JSONObject(json);

            JSONArray jsonArray = jsonObject.getJSONArray("data");

            for (int i = 0; i < jsonArray.length(); i++) {

                Search_hottag m = new Search_hottag();
                m.setData(jsonArray.getString(i));
                list.add(m);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }


}